package com.kd.spring.unit;

import static org.junit.Assert.*;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.kd.spring.service.IHelloWorldService;
import com.kd.spring.service.PersonService;
import com.kd.spring.service.impl.HelloWorldService;

public class TestAOp {

	@Test
	public void test() {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
		IHelloWorldService helloworldService = ctx.getBean(
				"helloWorldService", HelloWorldService.class);
		helloworldService.sayHello();  
	}
	
	@Test
	public void instance(){
		ApplicationContext  ctx = new ClassPathXmlApplicationContext("beans.xml");//单个配置文件
		PersonService personService = (PersonService)ctx.getBean("personService");
		personService.save();

	}

}
